import { AgentFull } from '@shared/interfaces/group'
import { FormGroup, FormBuilder } from '@angular/forms'
import { GroupStoreService } from './group-store.service'

export abstract class GroupNewBaseClass {
  group: AgentFull

  validateForm: FormGroup

  constructor(
    public fb: FormBuilder,
    public groupStore: GroupStoreService,
  ) {
    this.validateForm = this.fb.group({})
    this.initData()
  }

  initData(): void {
    this.groupStore
      .value$
      .subscribe(group => {
        this.group = group
      })
  }

  checkValid(): boolean {
    this.pushDataToStore()
    return true
  }

  abstract pushDataToStore(): void
}
